<template>
  <a-select
    show-search
    option-filter-prop="children"
    :allow-clear="true"
    :placeholder="$t(placeholderText)"
    mode="default"
    @change="changeOption"
    :value="defaultValue"
    :disabled="disabled"
  >
    <a-select-option v-for="item in chooseYesNoType" :key="item.id" :value="item.id">
      {{ $t(item.name) }}
    </a-select-option>
  </a-select>
</template>
<script>
import { mapState } from 'vuex'
export default {
  props: {
    defaultValue: {
      type: [String, Number, undefined],
      default: undefined
    },
    disabled: {
      type: Boolean,
      default: false
    },
    placeholderText: {
      type: String,
      default: ''
    }
  },
  computed: {
    ...mapState({
      chooseYesNoType: (state) => state.serviceConfig.chooseYesNoType
    })
  },
  data () {
    return {

    }
  },
  watch: {

  },
  created () {
  },
  methods: {
    changeOption (val) {
      this.$emit('changeoption', val)
    }
  }
}
</script>
